library(rstan)
library(survival)
library(tidyverse)
library(tidybayes)
# data, parameters, model and generated quantities blocks
Stan_exponential_survival_model <- "
data{
  int <lower=1> N_uncensored;
  int <lower=1> N_censored;
  int <lower=0> numCovariates;
  matrix[N_censored, numCovariates] X_censored;
  matrix[N_uncensored, numCovariates] X_uncensored;
  vector <lower=0>[N_censored] times_censored;
  vector <lower=0>[N_uncensored] times_uncensored;
}

parameters{
  vector[numCovariates] beta; //regression coefficients
  real alpha; //intercept
}

model{
  beta ~ normal(0,10); //prior on regression coefficients
  alpha ~ normal(0,10); //prior on intercept
  target += exponential_lpdf(times_uncensored | exp(alpha+X_uncensored * beta)); //log-likelihood part for uncensored times
  target += exponential_lccdf(times_censored | exp(alpha+X_censored * beta)); //log-likelihood for censored times
}

generated quantities{
  vector[N_uncensored] times_uncensored_sampled; //prediction of death
  for(i in 1:N_uncensored) {
    times_uncensored_sampled[i] = exponential_rng(exp(alpha+X_uncensored[i,]* beta));
  }
}
"
# prepare the data
set.seed(42); 
require (tidyverse);
data <- read_csv('../data.csv')
New names:
* `` -> ...1
Rows: 2066 Columns: 12
── Column specification ───────────────────────────────────────────────────────────────────────────────────────
Delimiter: ","
chr (3): url, host_type, project
dbl (8): ...1, major_releases, duration, author_count, rev_count, status, multi_repo, commits_per_day
lgl (1): commit_freq_above_median

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
N <- nrow (data); 
colnames(data)[which(names(data) == "commit_freq_above_median")] <- "high_freq"
data$high_freq <- car::recode(data$high_freq, "'TRUE' = 0; 'FALSE' = 1")
X <- as.matrix(pull(data, high_freq)); 
is_censored <- pull(data, status)==0; 
times <- pull(data, duration); 
msk_censored <- is_censored == 1; 
N_censored <- sum(msk_censored);
# put data into a list for Stan
Stan_data <- list (N_uncensored = N - N_censored, 
                    N_censored = N_censored,
                    numCovariates = ncol(X), 
                    X_censored = as.matrix(X[msk_censored,]),
                    X_uncensored = as.matrix(X[!msk_censored ,]), 
                    times_censored = times[msk_censored],
                    times_uncensored = times[!msk_censored])
# fit Stan model
require(rstan)
exp_surv_model_fit <- suppressMessages(stan(model_code = Stan_exponential_survival_model, data = Stan_data))
Warning in system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  error in running command
clang: error: no input files

SAMPLING FOR MODEL 'bf5dbbde6a245330de71a285e3fe7c42' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 0.00038 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 3.8 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 1.04718 seconds (Warm-up)
Chain 1:                1.0172 seconds (Sampling)
Chain 1:                2.06439 seconds (Total)
Chain 1: 

SAMPLING FOR MODEL 'bf5dbbde6a245330de71a285e3fe7c42' NOW (CHAIN 2).
Chain 2: 
Chain 2: Gradient evaluation took 0.000166 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 1.66 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 1.03852 seconds (Warm-up)
Chain 2:                1.08088 seconds (Sampling)
Chain 2:                2.1194 seconds (Total)
Chain 2: 

SAMPLING FOR MODEL 'bf5dbbde6a245330de71a285e3fe7c42' NOW (CHAIN 3).
Chain 3: 
Chain 3: Gradient evaluation took 0.000171 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 1.71 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 1.05682 seconds (Warm-up)
Chain 3:                0.965552 seconds (Sampling)
Chain 3:                2.02237 seconds (Total)
Chain 3: 

SAMPLING FOR MODEL 'bf5dbbde6a245330de71a285e3fe7c42' NOW (CHAIN 4).
Chain 4: 
Chain 4: Gradient evaluation took 0.000194 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 1.94 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 1.07081 seconds (Warm-up)
Chain 4:                1.08489 seconds (Sampling)
Chain 4:                2.1557 seconds (Total)
Chain 4: 
# print model fit
print(get_seed(exp_surv_model_fit))
[1] 1781592037
# print fit summary
fit_summary <- summary(exp_surv_model_fit)
print(fit_summary$summary)
                                       mean     se_mean           sd          2.5%           25%           50%
beta[1]                          -0.5627731 0.002051500   0.07849821    -0.7185476    -0.6156442    -0.5622044
alpha                            -4.7053300 0.001385949   0.05354377    -4.8135036    -4.7414188    -4.7046110
times_uncensored_sampled[1]     114.5263745 1.821339652 116.20953176     2.1146522    33.9126867    79.9736773
times_uncensored_sampled[2]     108.1134428 1.669845311 105.04229406     3.3082306    31.9875653    75.5178964
times_uncensored_sampled[3]     198.2410916 3.144339330 198.73890720     3.8884625    55.0230159   135.8153785
times_uncensored_sampled[4]     110.6483114 1.748954573 108.69457969     2.9578270    31.9239804    77.0404231
times_uncensored_sampled[5]     110.8150397 1.774953010 108.26286017     3.1555139    33.9398092    78.7307897
times_uncensored_sampled[6]     192.3124555 3.025133299 194.03377751     5.3754349    54.5858821   129.8933742
times_uncensored_sampled[7]     110.4297388 1.908294274 114.73922234     2.5394040    29.7074168    77.5391111
times_uncensored_sampled[8]     109.5966171 1.768562687 112.15323587     2.6537069    31.3291990    73.5612027
times_uncensored_sampled[9]     110.0911999 1.756423158 110.03112390     3.0187061    31.8232512    74.9396860
times_uncensored_sampled[10]    109.9939413 1.756583990 111.54308203     2.6627561    31.7422666    74.2301217
times_uncensored_sampled[11]    108.0187493 1.770858057 108.50192968     2.7915007    32.0544236    74.4241487
times_uncensored_sampled[12]    110.5245005 1.736415669 110.71848494     2.9914026    32.5554615    76.5090532
times_uncensored_sampled[13]    112.9162068 1.772189365 113.52095044     3.1299861    31.4018321    76.8538179
times_uncensored_sampled[14]    186.6070126 3.009718021 190.15873045     4.7652013    52.4184303   127.3520734
times_uncensored_sampled[15]    196.2323226 3.141083753 197.64262592     4.1662471    54.6850277   132.9723982
times_uncensored_sampled[16]    113.0754620 1.838293588 115.31869928     2.6663780    31.9207203    76.9207487
times_uncensored_sampled[17]    110.0234809 1.763211674 111.38828799     2.5408079    31.0041415    75.0049552
times_uncensored_sampled[18]    110.2099553 1.678901635 108.11420816     2.7162200    32.1855263    78.3886822
times_uncensored_sampled[19]    113.6374490 1.799516456 113.39152387     2.1226973    34.2365979    78.2821371
times_uncensored_sampled[20]    109.7046948 1.784999875 111.43566592     2.8095517    31.1294384    74.3680194
times_uncensored_sampled[21]    107.1621694 1.700989685 107.78229207     2.7316949    31.2003423    75.1161877
times_uncensored_sampled[22]    111.5307846 1.807296367 110.02902685     2.6380222    32.0740739    79.4585108
times_uncensored_sampled[23]    109.7564675 1.851334065 110.51000932     2.3302378    31.4596232    75.4311562
times_uncensored_sampled[24]    110.3380416 1.691599016 108.52366036     2.8875659    32.7641663    77.8362199
times_uncensored_sampled[25]    111.3387585 1.781248805 113.31858144     2.7620896    30.3301020    76.2134749
times_uncensored_sampled[26]    111.3020003 1.799731790 112.28836855     2.6169913    32.8450758    75.9414823
times_uncensored_sampled[27]    111.5768212 1.818555867 112.98596180     2.6092111    31.3010776    77.1494166
times_uncensored_sampled[28]    110.1185742 1.742310136 110.10975452     2.6420956    32.1703732    75.7350829
times_uncensored_sampled[29]    199.9052619 3.170949097 202.13583843     4.4764225    55.7346781   136.6155888
times_uncensored_sampled[30]    110.8966044 1.760556893 112.46014472     2.6548108    31.1138031    74.2863356
times_uncensored_sampled[31]    111.8069565 1.710141090 111.12915398     2.8444262    32.3653861    75.0249428
times_uncensored_sampled[32]    110.3347843 1.754607686 109.50101474     2.3626352    30.3844583    76.3061267
times_uncensored_sampled[33]    110.4732865 1.702497410 109.96368187     2.2211581    31.0841065    76.9794380
times_uncensored_sampled[34]    108.9838871 1.811134818 109.08468550     2.6841503    32.6238384    75.3325086
times_uncensored_sampled[35]    112.1110107 1.691647177 109.45638672     2.7120793    32.2584848    80.4234770
times_uncensored_sampled[36]    197.3236257 3.133386428 196.50690116     4.8286801    57.3932931   138.3078934
times_uncensored_sampled[37]    198.7881621 3.227680751 200.48430980     4.7757457    55.1949824   135.6173967
times_uncensored_sampled[38]    193.3519736 2.992925204 192.10140764     4.9713019    54.8870206   136.4986001
times_uncensored_sampled[39]    111.6041633 1.735598114 111.04532277     2.9470936    32.9211523    78.8363944
times_uncensored_sampled[40]    198.2285765 3.172411774 199.05200534     5.4593551    57.3709433   137.8305368
times_uncensored_sampled[41]    198.0499222 3.198066432 199.61965019     5.1013728    56.7165082   136.2629226
times_uncensored_sampled[42]    189.6244808 3.009094078 186.95841487     5.1943248    56.8035249   129.0151504
times_uncensored_sampled[43]    109.3335164 1.855588750 109.15671638     2.6468214    31.9087008    75.3574718
times_uncensored_sampled[44]    110.3631519 1.777750216 110.08715652     2.5820712    32.1916817    75.3665699
times_uncensored_sampled[45]    195.3372009 3.102399587 195.26204716     5.3476334    57.5212544   133.7463977
times_uncensored_sampled[46]    109.2836628 1.813945144 112.72642330     2.7900231    31.3280179    75.1503047
times_uncensored_sampled[47]    195.7074178 3.151071721 196.97531686     4.9410348    52.7104251   135.5520685
times_uncensored_sampled[48]    108.2731705 1.729221539 108.68364647     2.8680600    30.3723967    74.3242517
times_uncensored_sampled[49]    109.5471375 1.672776327 109.08240485     2.5505981    30.9331599    76.2364203
times_uncensored_sampled[50]    107.7838218 1.683408928 106.58577614     3.4239692    31.9165816    75.1780685
times_uncensored_sampled[51]    112.9284757 1.794551812 110.80418141     2.6309150    33.2734005    77.8626800
times_uncensored_sampled[52]    195.5230341 3.065063778 196.33660518     4.4256385    56.2145309   135.4578437
times_uncensored_sampled[53]    189.1881279 3.154967989 189.24924045     4.1070890    54.9357459   129.4628501
times_uncensored_sampled[54]    110.8698922 1.771884925 112.80592663     2.5762164    33.1198327    74.8076388
times_uncensored_sampled[55]    197.0692581 3.130246326 193.53590971     5.1111696    58.6161599   139.6874080
times_uncensored_sampled[56]    111.9859321 1.858310585 111.57399373     2.9828434    31.9792821    77.5187601
times_uncensored_sampled[57]    112.3565073 1.765208599 110.13158415     3.2518588    32.3872759    78.8510434
times_uncensored_sampled[58]    198.5731418 3.236329513 200.55140060     4.8884726    54.8635962   135.9055863
times_uncensored_sampled[59]    197.0131093 3.103526075 192.24459492     5.0497805    59.0448117   138.8798664
times_uncensored_sampled[60]    112.9511175 1.829230635 113.16397679     3.0370208    32.3713443    77.0118778
times_uncensored_sampled[61]    112.5459482 1.730343449 113.37611537     2.6734133    31.9992328    77.4659593
times_uncensored_sampled[62]    190.1537851 3.139313342 187.98272586     4.3450312    55.2266165   132.1019823
times_uncensored_sampled[63]    110.4392058 1.764243139 109.79809717     2.9731826    32.7995791    77.6213597
times_uncensored_sampled[64]    194.8143740 3.075940576 198.26387393     4.5875354    56.3749833   134.4837671
times_uncensored_sampled[65]    195.1939224 3.169885657 195.92340632     5.0078479    58.9701352   136.3159012
times_uncensored_sampled[66]    108.0587897 1.713615317 109.77044404     2.6836684    31.3205364    73.2563154
times_uncensored_sampled[67]    112.9125173 1.813717629 113.05824905     2.6170588    32.1563000    78.3873951
times_uncensored_sampled[68]    193.3883575 2.987271494 193.82240703     5.5605893    57.5109824   132.2883550
times_uncensored_sampled[69]    110.7901370 1.852771396 111.28096974     2.7329566    31.2563663    77.4522683
times_uncensored_sampled[70]    193.9051529 3.074031647 192.95722109     5.6653897    56.5439350   133.8992221
times_uncensored_sampled[71]    108.0550404 1.665360941 106.61177035     2.6025317    30.8195744    73.2645224
times_uncensored_sampled[72]    192.0605168 2.943853585 190.30410932     5.2334764    55.3034604   132.5029892
times_uncensored_sampled[73]    106.9616898 1.717349825 107.15448947     2.5836096    30.8345768    74.5055672
times_uncensored_sampled[74]    110.3850840 1.708965906 109.79443364     2.7402908    31.8043225    77.1152034
times_uncensored_sampled[75]    112.4601081 1.751805820 113.17809780     2.8237757    32.5866131    77.4002588
times_uncensored_sampled[76]    112.3728078 1.782821030 114.85923801     2.6604854    31.7591871    76.0423478
times_uncensored_sampled[77]    109.8077797 1.814980253 114.08883095     2.3144815    27.5580756    73.6727571
times_uncensored_sampled[78]    108.5342985 1.756699546 110.09148112     2.3985542    30.6574115    72.9389264
times_uncensored_sampled[79]    111.1941183 1.777138849 110.44994746     2.6967180    32.8870652    78.0399766
times_uncensored_sampled[80]    111.4391551 1.798038495 111.48540571     2.7982789    32.6480503    77.5253405
times_uncensored_sampled[81]    109.6729080 1.712414574 107.12634549     2.9906286    33.3792915    79.2478848
times_uncensored_sampled[82]    113.1907159 1.782675795 111.86554681     2.7539590    32.9230623    78.7693665
times_uncensored_sampled[83]    110.6905767 1.861117322 112.62311642     2.6201324    33.0517522    74.3652525
times_uncensored_sampled[84]    109.2696159 1.726568893 107.99236339     3.0831429    31.8313775    77.3217567
times_uncensored_sampled[85]    111.1374772 1.710844391 110.46872364     3.0176586    31.7096606    75.2640928
times_uncensored_sampled[86]    193.1838697 3.184533077 198.13646344     5.0545346    56.4280358   129.9965615
times_uncensored_sampled[87]    106.9349730 1.730559687 105.17234999     2.7496622    30.3533118    74.2710969
times_uncensored_sampled[88]    196.1561556 3.148901404 195.39696865     5.8014796    56.9950456   138.2400348
times_uncensored_sampled[89]    110.3082519 1.707172442 109.39114239     2.5125954    30.7431405    76.5523137
times_uncensored_sampled[90]    111.5968887 1.752408831 111.36411738     2.5043727    31.9454695    76.3181972
times_uncensored_sampled[91]    196.3470968 3.171881917 203.19167971     4.9790434    54.2039295   131.5912463
times_uncensored_sampled[92]    108.1853910 1.682194823 106.79060093     3.0732246    30.5940350    77.2905643
times_uncensored_sampled[93]    193.7856775 3.171041212 197.77650198     4.4147195    51.7858427   131.3225648
times_uncensored_sampled[94]    110.4495736 1.753802532 111.41869873     3.0301346    31.2247222    77.8784760
times_uncensored_sampled[95]    110.7470135 1.729248244 110.38309170     3.3899894    32.3240679    75.7008079
times_uncensored_sampled[96]    110.7178366 1.699295975 108.77867314     2.6173204    31.2850039    78.5609138
times_uncensored_sampled[97]    109.0123537 1.762037126 109.36560611     2.7747039    31.0490139    75.0323644
times_uncensored_sampled[98]    113.9142661 1.785220427 115.88348569     2.7179966    32.5015426    77.5602641
                                        75%         97.5%    n_eff      Rhat
beta[1]                          -0.5092253    -0.4115704 1464.119 1.0009443
alpha                            -4.6692041    -4.6013848 1492.531 1.0011599
times_uncensored_sampled[1]     155.4433502   424.3496532 4071.005 0.9995632
times_uncensored_sampled[2]     151.8881272   395.6997102 3957.090 0.9993291
times_uncensored_sampled[3]     278.1175553   729.9058376 3994.910 1.0008087
times_uncensored_sampled[4]     154.1481990   393.5580246 3862.413 1.0010428
times_uncensored_sampled[5]     154.3172431   406.2820482 3720.363 0.9996140
times_uncensored_sampled[6]     264.8440126   703.0275355 4114.013 0.9996292
times_uncensored_sampled[7]     150.5434171   408.6841783 3615.207 1.0010495
times_uncensored_sampled[8]     151.8632870   407.9896851 4021.450 0.9993076
times_uncensored_sampled[9]     156.9014829   406.3392412 3924.396 0.9999069
times_uncensored_sampled[10]    152.9744232   421.1811082 4032.250 1.0007298
times_uncensored_sampled[11]    147.4231930   387.6331059 3754.114 1.0010512
times_uncensored_sampled[12]    149.5544778   422.0344833 4065.677 0.9996629
times_uncensored_sampled[13]    157.6876329   415.8911987 4103.286 1.0005536
times_uncensored_sampled[14]    260.5349191   708.4601394 3991.912 1.0002259
times_uncensored_sampled[15]    276.2602601   726.4860414 3959.152 0.9995366
times_uncensored_sampled[16]    155.0272396   423.5979617 3935.226 0.9996193
times_uncensored_sampled[17]    151.9372806   422.6505829 3990.894 0.9997893
times_uncensored_sampled[18]    152.6000666   394.9463872 4146.819 0.9992755
times_uncensored_sampled[19]    157.0345048   421.8296492 3970.540 0.9994436
times_uncensored_sampled[20]    151.0951222   410.8303972 3897.374 1.0003819
times_uncensored_sampled[21]    148.5991449   392.8766251 4015.055 1.0001694
times_uncensored_sampled[22]    152.0897357   412.3611987 3706.430 1.0003877
times_uncensored_sampled[23]    151.6794691   395.0498224 3563.146 1.0001554
times_uncensored_sampled[24]    150.8363580   408.7220831 4115.798 0.9999315
times_uncensored_sampled[25]    152.6573321   419.7620907 4047.185 1.0003869
times_uncensored_sampled[26]    154.8989244   406.9789286 3892.727 1.0011408
times_uncensored_sampled[27]    153.9437025   429.7686166 3860.074 1.0013753
times_uncensored_sampled[28]    150.7053289   418.4637498 3993.932 0.9995258
times_uncensored_sampled[29]    279.7315811   738.5971978 4063.573 0.9996468
times_uncensored_sampled[30]    154.7378905   405.3235714 4080.347 0.9999331
times_uncensored_sampled[31]    155.9961830   412.9657772 4222.719 0.9992341
times_uncensored_sampled[32]    157.0416669   399.2120414 3894.720 1.0001441
times_uncensored_sampled[33]    154.9406370   418.7628221 4171.821 0.9992427
times_uncensored_sampled[34]    148.0606470   400.8423140 3627.655 1.0002963
times_uncensored_sampled[35]    154.9768540   406.4531787 4186.611 0.9991918
times_uncensored_sampled[36]    273.4041940   713.5147580 3933.034 1.0007590
times_uncensored_sampled[37]    275.4321033   732.0878302 3858.155 1.0000280
times_uncensored_sampled[38]    267.1602531   703.8315365 4119.736 1.0000365
times_uncensored_sampled[39]    151.8933485   405.3149502 4093.570 1.0012436
times_uncensored_sampled[40]    273.6745963   740.1466759 3936.897 0.9999303
times_uncensored_sampled[41]    273.7756108   735.0003592 3896.114 0.9994488
times_uncensored_sampled[42]    266.0765392   696.5246611 3860.277 0.9998679
times_uncensored_sampled[43]    149.9054401   416.1613155 3460.489 0.9998084
times_uncensored_sampled[44]    155.0531047   412.0696433 3834.704 1.0003016
times_uncensored_sampled[45]    269.2200310   724.1449021 3961.323 0.9995756
times_uncensored_sampled[46]    148.9059910   423.5818554 3861.919 1.0001918
times_uncensored_sampled[47]    269.4891251   716.3331407 3907.572 0.9995446
times_uncensored_sampled[48]    149.3557434   392.1194164 3950.273 0.9993770
times_uncensored_sampled[49]    150.1410749   407.3674207 4252.396 1.0001112
times_uncensored_sampled[50]    148.1476298   400.1815493 4008.845 0.9997435
times_uncensored_sampled[51]    158.0171865   412.0580278 3812.416 0.9995659
times_uncensored_sampled[52]    268.4095033   724.2534684 4103.208 1.0005161
times_uncensored_sampled[53]    260.7542578   694.6795417 3598.143 1.0004337
times_uncensored_sampled[54]    151.9848081   413.1646537 4053.151 1.0004361
times_uncensored_sampled[55]    274.0093841   710.5150390 3822.664 1.0001850
times_uncensored_sampled[56]    157.7603873   401.1848804 3604.868 0.9995065
times_uncensored_sampled[57]    158.8154533   394.2687233 3892.528 0.9996226
times_uncensored_sampled[58]    273.0285941   713.2958126 3840.130 1.0000100
times_uncensored_sampled[59]    277.7729494   705.4068810 3837.050 0.9998800
times_uncensored_sampled[60]    158.5445373   413.6319976 3827.185 0.9998950
times_uncensored_sampled[61]    155.3038762   418.5809072 4293.174 0.9998075
times_uncensored_sampled[62]    270.9538354   675.3483397 3585.639 0.9997213
times_uncensored_sampled[63]    153.4892651   394.2983141 3873.225 0.9998757
times_uncensored_sampled[64]    269.8857269   719.7626162 4154.620 1.0000748
times_uncensored_sampled[65]    267.9545624   727.6245631 3820.194 1.0000304
times_uncensored_sampled[66]    147.3273563   393.0093472 4103.403 1.0012920
times_uncensored_sampled[67]    155.6510899   426.0679237 3885.663 0.9997231
times_uncensored_sampled[68]    266.1606632   714.5464129 4209.772 0.9995455
times_uncensored_sampled[69]    154.4216450   402.0354154 3607.432 1.0000290
times_uncensored_sampled[70]    267.9461842   733.2750212 3940.083 1.0006691
times_uncensored_sampled[71]    149.7275470   398.0438588 4098.204 0.9996294
times_uncensored_sampled[72]    272.9121811   702.6464381 4178.919 0.9997263
times_uncensored_sampled[73]    149.2066784   393.9660371 3893.169 1.0001871
times_uncensored_sampled[74]    152.1345708   402.6867815 4127.564 0.9998100
times_uncensored_sampled[75]    155.1919939   402.8931911 4174.004 0.9997879
times_uncensored_sampled[76]    152.3158555   417.5904198 4150.652 0.9993528
times_uncensored_sampled[77]    152.0095113   422.9333956 3951.322 1.0003735
times_uncensored_sampled[78]    152.9087824   406.1686336 3927.466 0.9993340
times_uncensored_sampled[79]    154.7979102   404.3355464 3862.676 0.9996636
times_uncensored_sampled[80]    152.4638511   406.4967408 3844.484 1.0001029
times_uncensored_sampled[81]    148.7349301   395.4800443 3913.585 0.9995614
times_uncensored_sampled[82]    154.3292706   411.5500956 3937.748 1.0018439
times_uncensored_sampled[83]    153.6951043   405.2220533 3661.909 0.9992773
times_uncensored_sampled[84]    154.0888605   393.4428255 3912.175 0.9999959
times_uncensored_sampled[85]    156.3750849   407.9943137 4169.247 0.9997303
times_uncensored_sampled[86]    263.9198422   724.6817056 3871.126 0.9991486
times_uncensored_sampled[87]    149.9423046   390.0358502 3693.431 1.0002463
times_uncensored_sampled[88]    274.7452547   725.0482546 3850.503 1.0014153
times_uncensored_sampled[89]    156.9869259   404.0217356 4105.911 0.9998903
times_uncensored_sampled[90]    155.0585469   407.8482453 4038.496 1.0000828
times_uncensored_sampled[91]    271.0668398   738.1384308 4103.721 0.9999729
times_uncensored_sampled[92]    147.9347481   405.5016718 4030.078 1.0018519
times_uncensored_sampled[93]    272.0893941   709.1744071 3889.964 0.9996824
times_uncensored_sampled[94]    153.9761259   402.6573501 4036.034 0.9993945
times_uncensored_sampled[95]    152.8090047   417.6485294 4074.651 1.0005958
times_uncensored_sampled[96]    155.7092041   409.2277591 4097.788 0.9999564
times_uncensored_sampled[97]    151.4021571   399.2501981 3852.400 0.9998574
times_uncensored_sampled[98]    155.4155118   435.3941544 4213.659 0.9999416
 [ reached getOption("max.print") -- omitted 547 rows ]
exp_surv_model_draws <- tidybayes::tidy_draws(exp_surv_model_fit)
exp_surv_model_draws
## Constructor for Strata-specific survival function
construct_survival_function <- function(alpha, beta, x) {
    function(t) {
        lambda <- exp(alpha + x*beta)
        exp(-(lambda * t))
    }
}

## Random functions
exp_surv_model_surv_func <-
    exp_surv_model_draws %>%
    select(.chain, .iteration, .draw, alpha, `beta[1]`) %>%
    ## Simplify name
    rename(beta = `beta[1]`) %>%
    ## Construct realization of random functions
    mutate(`S(t|1)` = pmap(list(alpha, beta), function(a,b) {construct_survival_function(a,b,1)}),
           `S(t|0)` = pmap(list(alpha, beta), function(a,b) {construct_survival_function(a,b,0)}))
exp_surv_model_surv_func
times <- seq(from = 0, to = 165, by = 0.1)
times_df <- data_frame(t = times)

## Try first realizations
exp_surv_model_surv_func$`S(t|1)`[[1]](times[1:10])
 [1] 1.0000000 0.9994861 0.9989725 0.9984592 0.9979461 0.9974333 0.9969207 0.9964085 0.9958964 0.9953847
exp_surv_model_surv_func$`S(t|0)`[[1]](times[1:10])
 [1] 1.0000000 0.9990864 0.9981737 0.9972618 0.9963507 0.9954405 0.9945311 0.9936225 0.9927148 0.9918079
## Apply all realizations
exp_surv_model_survival <-
    exp_surv_model_surv_func %>%
    mutate(times_df = list(times_df)) %>%
    mutate(times_df = pmap(list(times_df, `S(t|1)`, `S(t|0)`),
                           function(df, s1, s0) {df %>% mutate(s1 = s1(t),
                                                               s0 = s0(t))})) %>%
    select(-`S(t|1)`, -`S(t|0)`) %>%
    unnest(cols = c(times_df)) %>%
    gather(key = Strata, value = survival, s1, s0) %>%
    mutate(Strata = factor(Strata, # Strata is whether or not projects have high commit frequency
                              levels = c("s1","s0"),
                              labels = c("high commit frequency=True","high commit frequency=False")))

## Average on survival scale
exp_surv_model_survival_mean <-
    exp_surv_model_survival %>%
    group_by(Strata, t) %>%
    summarize(survival_mean = mean(survival),
              survival_95upper = quantile(survival, probs = 0.975),
              survival_95lower = quantile(survival, probs = 0.025))
`summarise()` has grouped output by 'Strata'. You can override using the `.groups` argument.
exp_surv_model_survival
# plot the graphs
(ggplot(data = exp_surv_model_survival, mapping = aes(x = t, y = survival, color = Strata, group = interaction(.chain,.draw,Strata))) 
 + geom_line(size = 0.1, alpha = 0.02) 
 + geom_line(data = exp_surv_model_survival_mean, mapping = aes(y = survival_mean, group = Strata)) 
 + geom_line(data = exp_surv_model_survival_mean, mapping = aes(y = survival_95upper, group = Strata), linetype = "dotted") 
 + geom_line(data = exp_surv_model_survival_mean, mapping = aes(y = survival_95lower, group = Strata), linetype = "dotted")
 + scale_color_hue(direction = -1)
 + theme_bw()
 + theme(axis.text.x = element_text(angle = 90, vjust = 0.5), legend.key = element_blank(), plot.title = element_text(hjust = 0.5), strip.background = element_blank()))

LS0tCnRpdGxlOiAiQmF5ZXNpYW4gc3Vydml2YWwgYW5hbHlzaXMgdXNpbmcgY29tbWl0IGZyZXF1ZW5jeSBhcyBhIHByZWRpY3RvciIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQpgYGB7cn0KbGlicmFyeShyc3RhbikKbGlicmFyeShzdXJ2aXZhbCkKbGlicmFyeSh0aWR5dmVyc2UpCmxpYnJhcnkodGlkeWJheWVzKQpgYGAKIAoKYGBge3J9CiMgZGF0YSwgcGFyYW1ldGVycywgbW9kZWwgYW5kIGdlbmVyYXRlZCBxdWFudGl0aWVzIGJsb2Nrcwp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